/**
 * 
 */
package ru.athena.runTool.Parser;

import java.io.IOException;
import java.io.InputStream;

import org.antlr.runtime.*;

/**
 * @author corc_usr
 *
 */
public class CaseInsensitiveInputStream extends ANTLRInputStream {

	/**
	 * @param input
	 * @param encoding
	 * @throws IOException
	 */
	public CaseInsensitiveInputStream(InputStream input, String encoding)
			throws IOException {
		super(input, encoding);
	}

	/**
	 * @param input
	 * @throws IOException
	 */
	public CaseInsensitiveInputStream(InputStream input) throws IOException {
		super(input);
	}

	@Override
	public int LA(int i) {
        if (i == 0) {
            return 0;
        }
        if (i < 0) {
            i++;
        }
        if (((p + i) - 1) >= n) {
            return (int) CharStream.EOF;
        }
        // This is how "case insensitive" is defined, i.e., could 
        // also use a special culture...
        return Character.toLowerCase(data[(p + i) - 1]);
	}

}
